package models

/**
 *
 * @author  镜湖老杨
 * @date  2020/12/25 10:25 上午
 * @version 1.0
 */
import (
	_ "gorm.io/gorm"
	"time"
)

type Posts struct {
	ID          int64       `gorm:"column:ID;primaryKey" json:"uid"`
	Title        string       `gorm:"column:post_title" json:"title" `
	Summary      string       `gorm:"column:post_excerpt" json:"summary"`
	Content      string       `gorm:"column:post_content" json:"content"`
	PostStatus	string `gorm:"column:post_status" json:"status"`
	PhotoList     []string       `gorm:"-" json:"photoUrlList"`
	PhotoUrl     string       `gorm:"-" json:"photoUrl"`
	BlogSortName string       `gorm:"-" json:"blogSortName"`
	PostAuthor       int64       `gorm:"column:post_author" json:"authorcode"`
	Authors     WpUsers     `gorm:"foreignKey:PostAuthor;references:ID" json:"authors"`
	CreateTime   time.Time `gorm:"column:post_date_gmt" json:"createTime"`
	Sorts []WpTermRelationships `gorm:"foreignKey:ObjectId;references:ID" json:"sorts"`
	Author    string       `gorm:"-" json:"author"`
}

func (*Posts) TableName() string {
	return "wp_posts"
}
